<?php
$this->Html->addCrumb('Services','/services');
$this->Html->addCrumb($serviceInfo['Service']['name']);
//css
echo $this->Html->css(array('jquery.cluetip'), false);
//js
echo $this->Html->script(array('plugins/jquery.cluetip'), false);

$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $(".ad_logo img").each(function(index, value) {
        if($(this).attr("data-desc")){
          $(this).attr("title",$(this).attr("rel"));
           $(this).addClass("logo");
          }
        });
        $("img.logo").cluetip({ cluetipClass: "jtip", arrows: true, splitTitle : "|",  positionBy : "mouse" , topOffset : 20, leftOffset : 40,
          hoverIntent: {
            sensitivity:  30,
            interval: 200,
            timeout: 0
          },
          fx :{open : "fadeIn", speed : "slow"},
          clickThrough : true
        });
      });
       ';
$this->Html->scriptEnd();
?>
<div>
  <h1 class="inline"><?php echo $serviceInfo['Service']['name'] ?></h1>
  <?php if(empty($companies)) { ?>
    <p>No specials on vendor services are currently available.</p>
  <?php } else {
    echo '<div id="servicesContainer" style="position: relative;">';
    foreach($companies as $company) { 
      $rec = $company['Company']; $adRec = $company['Ad'];
      $thumb = !empty($rec['image_path']) ? $rec['image_path'] : Configure::read('App.servicesDefaultImage');
     // if(sizeof($company['AdPhotos'])!=0){
    ?>
    <div class="ad_logo"> <?php echo $this->Html->image($thumb, array('alt' => $rec['name'],'title'=>$rec['name'],'class'=>'center', 'rel'=>$rec['name'].'|'.nl2br($rec['description']), 'data-desc'=>$rec['description'], 'url'=>array('controller'=>'ads', $adRec['ad_id'])))?>
      <div><span class="ad_logo_text"><?php echo $rec['name'];?></span></div>
    </div>
  <?php } //}
  echo "</div>";

   echo $this->element('main_pagination');
  } ?>
</div>